﻿@using KRM.Core

@using KRM.Core.Library
@model KRM.Core.Task
@{
    ViewBag.Title = "ApproveTask";
}
        <div class="modal-header" >
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
            <h5 id="myModalLabel">Approve Task</h5>
        </div>
@if (Users.Current(User.Identity.Name) != null)
{
    if(Users.Current(User.Identity.Name).HasPermission(Permissions.CanApproveWattingTask))
    {
        <div class="modal-body body-ApproveTask">
            <div class="msg-ApproveTask hide">
                 <div class="alert alert-error">
                        <strong>OrderRef incorrect!</strong>
                        @*<button type="button" class="close" data-dismiss="alert">×</button>*@
                    </div>
            </div>
            <input type="hidden" name = "TaskId"value="@Model.TaskID"/>
            <div style="padding: 0px" class="bodyhf-ApproveTask">
                <div class="task-panel">
                    <div class="row-fluid">
                        <div class="span3">Type</div>
                        <div class="span9">
                            @Html.DropDownList("TaskTypeID", null, new {onchange = "tasktypeapprovechange(this.value)"})
                        </div>
                    </div>
                    <div class="row-fluid">
                        <div class="span3">Title</div>
                        <div class="span9">
                            @Html.DropDownList("TaskTitleID", null, new {required = "required"})
                        </div>
                    </div>
                    <div class="row-fluid">
                        <div class="span3">Description</div>
                        <div class="span9"> 
                            <textarea name="TaskDescription"  style="width: 96%" rows="2" >@Model.TaskDescription</textarea>
                        </div>
                    </div>
                    <div class="row-fluid">
                        <div class="span3">Reason</div>
                        <div class="span9">
                        <select name="reason">
                            <option value="Customer Change Of Circumstances">Customer Change Of Circumstances</option>
                            <option value="Damaged">Damaged</option>
                            <option value="Incorrect">Incorrect</option>
                            <option value="Missing">Missing</option>
                            <option value="Other">Other</option>
                        </select></div>
                    </div>
                </div>
                <div class="task-panel">
                    <div class="row-fluid">
                        <div class="span3">Order Ref</div>
                        <div class="span9"><input type="text" id="txtOrderRef" name="OrderRef" required = "required" class="text"/></div>
                    </div> 
                </div>
                <div class="task-panel">
                    <div class="row-fluid">
                        <div class="span3">Assign To</div>
                        <div class="span6">
                            @Html.DropDownList("AssignedToUser")
                        </div>
                    </div>
                    <div class="row-fluid">
                        <div class="span3">Completed By</div>
                        <div class="span9">
                            <div id="datetimepicker4" class="input-append">
                                <input data-format="MM/dd/yyyy HH:mm:ss PP" type="text" name="CompleteByDate" value="@DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss tt")" id="datestart" required="required"/>
                                <span class="add-on">
                                    <i data-time-icon="icon-time" data-date-icon="icon-calendar" class="icon-calendar "></i>
                                </span>
                            </div>
                        </div>
                    </div>
                    <div class="row-fluid">
                        <div class="span3">Duration</div>
                        <div class="span3">
                            @Html.DropDownList("DurationID", null, null, new {@class = "span10"})
                        </div>
                        <div class="span2">Priority</div>
                        <div class="span3">
                            @Html.DropDownList("PriorityID", null, new {@class = "span10"})
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="modal-footer" >
            <button class="btn btn-primary" id ="btnApproveTask" type="button" onclick="btnapproveclick()">Approve task</button>
            <a class="btn btn-danger" id ="btndeletetask" href="/task/deletetask/@Model.TaskID">Delete</a>
            <a class="btn" data-dismiss="modal" aria-hidden="true">Close</a>
        </div>
    }
    else
    {
        <p class="text-center" style="padding: 20px; font-weight: bold">You do not have permissions for approve a task.</p>
    }
}
else
{
    <p class="text-center" style="padding: 20px; font-weight: bold">Session login expired. Please close window and login again.</p>
}